<?php
/**
 * Created by PhpStorm.
 * User: coolinmind
 * Date: 25/01/2019
 * Time: 16:57
 */

namespace App\Services\UCenter;


use App\Services\UCenter\UCenter\OrderLogic;

class Order
{
    /**
     * 生成订单
     * @param $data
     * @return array
     * @throws \App\Exceptions\RequestFailException
     */
    public function createOrder($data)
    {
        $data = pick_array($data, ['id', 'user_id']);
        ValidateOrder::checkValidate($data, ['id', 'user_id']);
        return (new OrderLogic())->createOrder($data);
    }

    /**
     * 获取订单列表
     * @param $data
     * @return array
     * @throws \App\Exceptions\RequestFailException
     */
    public function getOrderList($data)
    {
        $data = pick_array($data, ['page', 'user_id', 'per_page']);
        ValidateOrder::checkValidate($data, ['page', 'user_id', 'per_page']);
        return (new OrderLogic())->getOrderList($data);
    }
}
